﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- <meta charset="utf-8"> -->
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>TCTNB SharingResource</title>
<link href="<%=request.getContextPath()%>/js/css/main.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/js/css/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery.pagination.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/work.js"></script>
<script type="text/javascript" >
function pageselectCallback(page_index, jq){
        var itemName = $(".itemName").html(),kw = $("#keyword").val();
        /* alert(page_index); */
   		 switch(itemName)
   		{
   		case "Windows":
   			itemName = "W" ;
   		  break;
   		case "Ubuntu":
   			itemName = "U" ; ;
   		  break;
   		case "安装文档":
   			itemName = "D" ; ;
   		  break;
   		case "其他软件":
   			itemName = "O" ; ;
   		  break;
   		default:
   			itemName = null ; ;
   		  break;
   		} 
   		  /*  $("#pageination").show() ; */
    	   $("#all_res").load("resource_search",{"ResourceName":kw,"ResourceType":itemName,"pageIndex":page_index+1,"pageSize":5});
            return false;
            }
$(document).ready(function(){
var pagecount=$("#Rcount").val() ;
$(".pagination").pagination(pagecount, {
    callback: pageselectCallback,
     next_text:"下一页",
     prev_text:"上一页",
     num_edge_entries: 1,
 
    });
});
</script>
</head>
<body style="height:3000px;">

<%@ include file="top.jsp" %> 


<div style="text-align:center;clear:both"></div>

<br />

<div id = "all_res"  ></div>


<div class="pagination" style="margin: 0px auto 0px 30%;display:none ;" ></div>
</body>
<script  type="text/javascript"> 
$(function(){
  $("#all_res").load("resAllList") ;
})

var pageIndex = 0;     //页面索引初始值   
var pageSize = 10;     //每页显示条数初始化，修改显示条数，修改这里即可   
$(function () {
        /*InitTable(0);  */  //Load事件，初始化表格数据，页面索引为0（第一页）
       //分页，PageCount是总条目数，这是必选参数，其它参数都是可选
	   $("#pageination").pagination(30, {
           callback: PageCallback,  //PageCallback() 为翻页调用次函数。
           prev_text: "« 上一页",
           next_text: "下一页 »",
           items_per_page:pageSize,
           num_edge_entries: 2,       //两侧首尾分页条目数
           num_display_entries: 6,    //连续分页主体部分分页条目数
           current_page: pageIndex,   //当前页索引
       });
        
       
   }); 




       //翻页调用   
       function PageCallback(index, jq) {             
           InitTable(index);  
       } 
       //请求数据   
       function InitTable(pageIndex) { 
    	   /*var resourceName= $("Kword").val() ;
   		   var resourceType= $("Rtype").val() ;*/
    	   var itemName = $(".itemName").html(),kw = $("#keyword").val();
   		
   		switch(itemName)
   		{
   		case "Windows":
   			itemName = "W" ;
   		  break;
   		case "Ubuntu":
   			itemName = "U" ; ;
   		  break;
   		case "安装文档":
   			itemName = "D" ; ;
   		  break;
   		case "其他软件":
   			itemName = "O" ; ;
   		  break;
   		default:
   			itemName = null ; ;
   		  break;
   		}
   		   $("#pageination").show() ;
    	   $("#resource_search").load("resource_search",{"ResourceName":kw,"ResourceType":itemName,"pageIndex":pageIndex,"pageSize":pageSize});
           /*$.ajax({   
               type: "POST",  
               dataType: "text",  
               url: 'resource_search',      //提交到一般处理程序请求数据   
               data: "pageIndex=" + (pageIndex) + "&pageSize=" + pageSize,          //提交两个参数：pageIndex(页面索引)，pageSize(显示条数)                   
               success: function(data) {
               $("#resource_search").load("resource_search") ;
                    $("#Result tr:gt(0)").remove();         //移除Id为Result的表格里的行，从第二行开始（这里根据页面布局不同页变）   
                    $("#Result").append(data);              //将返回的数据追加到表格   
               }  
           }); */
       }  
</script>
</html>
